

CDEFNAMES = \
		_dbl2str \
		_digits  \
		_flt2str \
		_fmtinpt \
		_ldigits \
		_lnum2str \
		_num2str \
		_str2num \
		_syscall \
		_xpndfmt \
		api      \
		readline

CTYPENAMES = \
		isalnum \
		isalpha \
		isascii \
		iscntrl \
		isdigit \
		isgraph \
		islower \
		isprint \
		ispunct \
		isspace \
		isupper \
		isxdigit \
		tolower \
		toupper

FCNTLNAMES	= open

LIBGENNAMES	= \
		basename \
		dirname

LOCALENAMES	= setlocale

MATHNAMES	= \
		ceil \
		cos \
		cosf \
		fabs \
		floor \
		floorf \
		fmod \
		modf \
		pow \
		sin \
		sinf \
		sqrt \
		tan \
		tanf

SIGNALNAMES	= signal

STDIONAMES = \
		fclose \
		fflush \
		fgetpos \
		fgets \
		fopen \
		fprintf \
		fread \
		fscanf \
		fseek \
		fsetpos \
		ftell \
		fwrite \
		getc \
		getchar \
		gets \
		perror \
		printf \
		putc \
		putchar \
		puts \
		remove \
		rename \
		rewind \
		scanf \
		snprintf \
		sprintf \
		sscanf \
		vfprintf \
		vfscanf \
		vprintf \
		vscanf \
		vsnprintf \
		vsprintf \
		vsscanf

STDLIBNAMES = \
		abort \
		abs \
		calloc \
		exit \
		labs \
		malloc \
		mbtowc \
		mbstowcs \
		qsort \
		rand \
		rand_r \
		realloc \
		realpath \
		srand \
		system \
		wctomb

STRINGNAMES = \
		bcopy \
		bzero \
		ffs \
		memcmp \
		memcpy \
		memmove \
		memset \
		strcasecmp \
		strcasestr \
		strcat \
		strchr \
		strcmp \
		strcpy \
		strdup \
		strerror \
		strlen \
		strncasecmp \
		strncat \
		strncmp \
		strncpy \
		strnlen \
		strrchr \
		strspn \
		strstr

TIMENAMES = \
		asctime \
		clock \
		difftime \
		time

UNISTDNAMES = \
		close \
		getopt \
		lseek \
		read \
		stat \
		swab \
		write

CRTNAMES = \
		crt1

ALLNAMES = ${CDEFNAMES} ${CTYPENAMES} ${FCNTLNAMES} ${LIBGENNAMES} \
	${LOCALENAMES} ${MATHNAMES} ${SIGNALNAMES} ${STDIONAMES} \
	${STDLIBNAMES} ${STRINGNAMES} ${TIMENAMES} ${UNISTDNAMES} ${CRTNAMES}

BUILDDIR = $(M_P_LIBRARIES)
TARGETS  = libkc.a libc.so
SOURCES  = $(ALLNAMES)

CRT0 = $(M_DIR_BUILD)/$(BUILDDIR)/crt0.o

CFLAGS_O = -Dailes_libc_in_kernel=1
CFLAGS_PIC_O = -Dailes_libc_in_kernel=0
CFLAGS_O_memcpy = -O3
CFLAGS_PIC_O_memcpy = -O3

#LFLAGS += -static
USING_LIB_NO_DEP = gcc
LFLAGS__ = -static

include $(M_MAKEBUILD)

all: ${CRT0}

$(CRT0): crt0.c $(STDDEPS)
	@echo "CC      "$@
	@${CC} ${CFLAGS} -c $< -o $@
